<?php
/**
 * Data model
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 */
/**
 * Data model for table "project"
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 *
 * @property-read mixed Id
 * @property-read mixed Name
 * @property-read mixed Logo
 * @property-read mixed Title
 * @property-read mixed Description
 * @property-read mixed State
 */
abstract class BaseProject extends BaseRecord
{
    const TABLE_NAME = "project";

    public function __construct()
    {
        parent::__construct(self::TABLE_NAME);
    }

    protected function initFields()
    {
        $this->hasColumn('id', 'PA:int(3)');
        $this->hasColumn('name', 'N:varchar(255)');
        $this->hasColumn('logo', 'N:varchar(255)');
        $this->hasColumn('title', 'N:varchar(255)');
        $this->hasColumn('description', 'N:text');
        $this->hasColumn('state', 'N:tinyint(1)|1');
    }

    public function initRelations()
    {
        $this->addRelation('Folder', new ORMRelationOne2One('Pfolder', 'id', 'project_id'));
        $this->addRelation('Settings', new ORMRelationOne2One('Settings', 'id', 'project_id'));    
    }

    public function getById($id)
    {
        return parent::getById($id, 'Project');
    }

    public function getByParams( $params, $type = ORMRecord::ONE_RECORD, $limit = null )
    {
        return parent::getByParams( $params, $type, $limit, 'Project');
    }

    public function getAll( $limit = null )
    {
        return parent::getAll( $limit, 'Project' );
    }
}